package com.java.onlineshop.service.impl;

import com.java.onlineshop.dao.IUserDao;
import com.java.onlineshop.impl.UserDaoImpl;
import com.java.onlineshop.pojo.Country;
import com.java.onlineshop.pojo.Province;
import com.java.onlineshop.pojo.User;
import com.java.onlineshop.pojo.Userinfo;
import com.java.onlineshop.service.IUserService;

import java.sql.SQLException;
import java.util.List;

/**
 * @program: onlineshop
 * @description: IUserService的实现类
 * @author: ShuangChenYue
 * @create: 2021-05-28 12:04
 **/
public class UserServiceImpl implements IUserService
{
    IUserDao userDao = new UserDaoImpl();

    @Override
    public List<Country> findAllCountry()
    {
        return userDao.findAllCountry();
    }

    @Override
    public List<Province> findAllProvince()
    {
        return userDao.findAllProvince();
    }

    @Override
    public void userRegister(User user)
    {
        userDao.addUser(user);
    }

    @Override
    public User userLogin(String name, String password)
    {
        return userDao.findUserByNameAndPassword(name, password);
    }

    @Override
    public void updateUser(User user) throws SQLException
    {
        userDao.updateUser(user);
    }

}
